package com.heima.comment.controller;

import com.heima.comment.dto.CommentRepayDto;
import com.heima.comment.dto.CommentRepayLikeDto;
import com.heima.comment.dto.CommentRepaySaveDto;
import com.heima.comment.service.ICommentRepayService;
import com.heima.common.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author WSJ
 * @Date 2022-03-29-12:16
 * @Version 1.0 （版本号）
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {
@Autowired
private ICommentRepayService commentRepayService;

    /**
     * 保存对评论的评论
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody CommentRepaySaveDto dto) {
        return commentRepayService.save(dto);
    }

    /**
     * 评论的评论列表
     * @param dto
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayDto dto) {
        return commentRepayService.load(dto);
    }

    /**
     * 点赞、取消点赞
     * @param dto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentRepayLikeDto dto) {
        return commentRepayService.like(dto);
    }
}
